import React, { Component } from 'react'
import { connect } from 'react-redux'
import { push } from 'connected-react-router'
import { Table } from 'semantic-ui-react'

class Link extends Component {
  render() {
    const { src, children, link } = this.props
    return (
      <Table.Cell className="avatar" onClick={() => link(src)}>
        <a>{children}</a>
      </Table.Cell>
    )
  }
}

const mapDispatchToProps = {
  link: path => push(path),
}

export default connect(
  null,
  mapDispatchToProps,
)(Link)
